﻿@model ProductListFVM
@{
    PageMeta pm = (PageMeta)ViewBag.PageMeta;
    ViewBag.Title = pm != null ? pm.Title : "产品展示";
}
@section header{
    @if (pm != null)
    {
        <meta name="description" content="@pm.Description" />
        <meta name="keywords" content="@pm.Keyword" />
    }

}

<!-- PAGE TITLE ================================================== -->
<div class="container page-products">
    <div class="row">
        <div class="col-md-3">
            <div class="page-title">
                <h2>@ViewBag.Title</h2>
                <p>
                    PRODUCTS
                </p>
            </div>
        </div>
        <div class="col-md-9">
            @{
                var allClass = Model.CategoryId == null ? "active" : "";
            }
            <div id="filter" class="categories">
                <div class="categorybox">
                    <a href="@Url.Action("index")" title="所有产品" class="@allClass" data-toggle="tooltip" data-placement="bottom">
                        <div class="icon">
                            <i class="iconfont">&#xe632;</i>
                        </div>
                    </a>
                </div>
                @foreach (var category in Model.Categories)
                {
                    var className = (Model.CategoryId == category.Id) ? "active" : "";
                    <div class="categorybox">
                        <a href="@Url.Action("index",new { cateId = category.Id })" class="@className" title="@category.Title" data-toggle="tooltip" data-placement="bottom">
                            <div class="icon">
                                <i class="iconfont @category.ImageUrl"></i>
                            </div>
                        </a>
                    </div>


                }

            </div>
        </div>
    </div>


</div>

<hr />

<!-- products   ================================================== -->
<section class="container page-products m-b-50">
    <div id="productlist" class="row">
        @foreach (var product in Model.Products)
        {
            Html.RenderPartial("PartialProductBox", product);
        }
    </div>
    @if (Model.Products.Any())
    {
        @Html.PagedListPager((IPagedList)Model.Products, page => Url.Action("Index", new { page, cateId = Model.CategoryId }), PagedListRenderOptions.OnlyShowFivePagesAtATime)
    }
    else
    {
        <div class="alert alert-info">
            <span class="iconfont icon-info"></span> 未找到任何产品
        </div>
    }

</section>
@section footer{
    <script>
        $(function () {
            $("#mainav li").eq(2).addClass("active");
        })
    </script>

}